﻿/*
' DotNetNuke® - http://www.dotnetnuke.com
' Copyright (c) 2002-2006
' by Perpetual Motion Interactive Systems Inc. ( http://www.perpetualmotion.ca )
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
' DEALINGS IN THE SOFTWARE.
 */

using System;
using System.Data;
using System.Data.SqlClient;

using Microsoft.ApplicationBlocks.Data;

using DotNetNuke.Common.Utilities;
using DotNetNuke.Framework.Providers;

namespace Triax.Modules.Department
{
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// The SqlDataProvider class is a SQL Server implementation of the override DataProvider
    /// </summary>
    /// <remarks>
    /// </remarks>
    /// <history>
    /// </history>
    /// -----------------------------------------------------------------------------
    public class SqlDataProvider : DataProvider
    {

    #region Private Members

        private const string ProviderType = "data";
        private const string ModuleQualifier = "Triax_";

        private ProviderConfiguration _providerConfiguration = ProviderConfiguration.GetProviderConfiguration(ProviderType);
        private string _connectionString;
        private string _providerPath;
        private string _objectQualifier;
        private string _databaseOwner;

    #endregion

    #region Constructors

        /// <summary>
        /// Constructs new SqlDataProvider instance
        /// </summary>
        public SqlDataProvider()
        {
            //Read the configuration specific information for this provider
            Provider objProvider = (Provider)_providerConfiguration.Providers[_providerConfiguration.DefaultProvider];

            //Read the attributes for this provider
            //Get Connection string from web.config
            _connectionString = Config.GetConnectionString();

            if (_connectionString.Length == 0) 
			{
                //Use connection string specified in provider
                _connectionString = objProvider.Attributes["connectionString"];
            }

            _providerPath = objProvider.Attributes["providerPath"];

            _objectQualifier = objProvider.Attributes["objectQualifier"];

            if ((_objectQualifier != "") && (_objectQualifier.EndsWith("_") == false))
            {
                _objectQualifier += "_";
            }

            _databaseOwner = objProvider.Attributes["databaseOwner"];
            if ((_databaseOwner != "") && (_databaseOwner.EndsWith(".") == false))
            {
                _databaseOwner += ".";
            }
        }
    
    #endregion

    #region Properties

        /// <summary>
        /// Gets and sets the connection string
        /// </summary>
        public string ConnectionString
        {
            get {   return _connectionString;   }
        }

        /// <summary>
        /// Gets and sets the Provider path
        /// </summary>
        public string ProviderPath
        {
            get {   return _providerPath;   }
        }

        /// <summary>
        /// Gets and sets the Object qualifier
        /// </summary>
        public string ObjectQualifier
        {
            get {   return _objectQualifier;   }
        }

        /// <summary>
        /// Gets and sets the database ownere
        /// </summary>
        public string DatabaseOwner
        {
            get {   return _databaseOwner;   }
        }

    #endregion

    #region Private Methods

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets the fully qualified name of the stored procedure
        /// </summary>
        /// <param name="name">The name of the stored procedure</param>
        /// <returns>The fully qualified name</returns>
        /// -----------------------------------------------------------------------------
        private string GetFullyQualifiedName(string name)
        {
            return DatabaseOwner + ObjectQualifier + ModuleQualifier + name;
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets the value for the field or DbNull if field has "null" value
        /// </summary>
        /// <param name="Field">The field to evaluate</param>
        /// <returns></returns>
        /// -----------------------------------------------------------------------------
        private Object GetNull(Object Field)
        {
            return Null.GetNull(Field, DBNull.Value);
        }

    #endregion

    #region Public Methods

        // Department
        public override void AddDepartment(int ModuleId, string DepartmentName, string Description, int ParentId, int DepartmentType, int Status, int UserID,  int DepartmentUserId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddDepartment"), ModuleId, DepartmentName, Description, ParentId, DepartmentType, Status, UserID, DepartmentUserId);
        }

        public override void DeleteDepartment(int ModuleId, int DepartmentId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteDepartment"), ModuleId, DepartmentId);
        }

        public override IDataReader GetDepartment(int ModuleId, int DepartmentId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetDepartment"), ModuleId, DepartmentId);
        }

        public override IDataReader GetDepartments(int ModuleId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetDepartments"), ModuleId);
        }

        public override void UpdateDepartment(int ModuleId, int DepartmentId, string DepartmentName, string Description, int ParentId, int DepartmentType, int Status, int UserID, int DepartmentUserId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateDepartment"), ModuleId, DepartmentId, DepartmentName, Description, ParentId, DepartmentType, Status, UserID, DepartmentUserId);
        }

        public override IDataReader GetDepartmentsByParent(int ModuleId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetDepartmentsByParent"), ModuleId);
        }

        public override IDataReader GetAllDepartmentsByParent(int ModuleId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetAllDepartmentsByParent"), ModuleId);
        }

        public override IDataReader GetDepartmentsByCond(int ModuleId, string Cond, string Sql)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetDepartmentsByCond"), ModuleId, Cond, Sql);
        }

        // DepartmentSubject
        public override void AddDepartmentSubject(int ModuleId, int DepartmentId, int SubjectId, int Status, int UserId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddDepartmentSubject"), ModuleId, DepartmentId, SubjectId, Status, UserId);
        }

        public override IDataReader GetDepartmentSubject(int ModuleId, int DepartmentSubjectId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetDepartmentSubject"), ModuleId, DepartmentSubjectId);
        }

        public override IDataReader GetDepartmentSubjects(int ModuleId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetDepartmentSubjects"), ModuleId);
        }

        public override void UpdateDepartmentSubject(int ModuleId, int DepartmentSubjectId, int DepartmentId, int SubjectId, int Status, int UserId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateDepartmentSubject"), ModuleId, DepartmentSubjectId, DepartmentId, SubjectId, Status, UserId);
        }

        public override void DeleteDepartmentSubject(int ModuleId, int DepartmentSubjectId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteDepartmentSubject"), ModuleId, DepartmentSubjectId);
        }

        public override IDataReader GetDepartmentSubjectsByCond(int ModuleId, string Cond, string Sql)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetDepartmentSubjectsByCond"), ModuleId, Cond, Sql);
        }

        public override void DeleteDepartmentSubjectByCond(int ModuleId, string Cond, string Sql)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteDepartmentSubjectByCond"), Cond, Sql);
        }


        //  Đơn vị tập đoàn
        public override void AddDonViTapDoan(int ModuleId,

                                               string code,
                                               string title,
                                               int ParentId,
                                               string Description,
                                               double temp_double1,
                                               double temp_double2,
                                               string temp_string1,
                                               string temp_string2,
                                               string temp_string3,
                                               int temp_int1,
                                               int temp_int2,
                                               int temp_int3,
                                               int CreatedByUser,
                                               DateTime CreatedDate,
                                               int UpdatedByUser,
                                               DateTime UpdatedDate
           )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddDonViTapDoan"), ModuleId,
                    code,
title,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate
                );
        }

        public override void DeleteDonViTapDoan(int ModuleId, int ItemId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteDonViTapDoan"), ModuleId, ItemId);
        }

        public override IDataReader GetDonViTapDoan(int ModuleId, int ItemId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetDonViTapDoan"), ModuleId, ItemId);
        }

        public override IDataReader GetDonViTapDoans(int ModuleId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetDonViTapDoans"), ModuleId);
        }

        public override IDataReader GetDonViTapDoansByCond(int ModuleId, string cond, string sql)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetDonViTapDoansByCond"), ModuleId, cond, sql);
        }

        public override void UpdateDonViTapDoan(int ModuleId,
            int id,
                                                    string code,
                                                    string title,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateDonViTapDoan"), ModuleId,
                id,
                code,
title,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate


                );
        }
        // End Đơn vị tập đoàn

        //  Loại hình đơn vị
        public override void AddLoaiHinhDonVi(int ModuleId,

                                               string code,
                                               string title,
                                               int ParentId,
                                               string Description,
                                               double temp_double1,
                                               double temp_double2,
                                               string temp_string1,
                                               string temp_string2,
                                               string temp_string3,
                                               int temp_int1,
                                               int temp_int2,
                                               int temp_int3,
                                               int CreatedByUser,
                                               DateTime CreatedDate,
                                               int UpdatedByUser,
                                               DateTime UpdatedDate
           )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddLoaiHinhDonVi"), ModuleId,
                    code,
title,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate
                );
        }

        public override void DeleteLoaiHinhDonVi(int ModuleId, int ItemId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteLoaiHinhDonVi"), ModuleId, ItemId);
        }

        public override IDataReader GetLoaiHinhDonVi(int ModuleId, int ItemId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetLoaiHinhDonVi"), ModuleId, ItemId);
        }

        public override IDataReader GetLoaiHinhDonVis(int ModuleId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetLoaiHinhDonVis"), ModuleId);
        }

        public override IDataReader GetLoaiHinhDonVisByCond(int ModuleId, string cond, string sql)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetLoaiHinhDonVisByCond"), ModuleId, cond, sql);
        }

        public override void UpdateLoaiHinhDonVi(int ModuleId,
            int id,
                                                    string code,
                                                    string title,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateLoaiHinhDonVi"), ModuleId,
                id,
                code,
title,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate


                );
        }
        // End Loại hình đơn vị

        //  NHóm vụ việc
        public override void AddNhomVuViec(int ModuleId,

                                               string code,
                                               string title,
                                               int ParentId,
                                               string Description,
                                               double temp_double1,
                                               double temp_double2,
                                               string temp_string1,
                                               string temp_string2,
                                               string temp_string3,
                                               int temp_int1,
                                               int temp_int2,
                                               int temp_int3,
                                               int CreatedByUser,
                                               DateTime CreatedDate,
                                               int UpdatedByUser,
                                               DateTime UpdatedDate
           )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddNhomVuViec"), ModuleId,
                    code,
title,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate
                );
        }

        public override void DeleteNhomVuViec(int ModuleId, int ItemId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteNhomVuViec"), ModuleId, ItemId);
        }

        public override IDataReader GetNhomVuViec(int ModuleId, int ItemId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetNhomVuViec"), ModuleId, ItemId);
        }

        public override IDataReader GetNhomVuViecs(int ModuleId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetNhomVuViecs"), ModuleId);
        }

        public override IDataReader GetNhomVuViecsByCond(int ModuleId, string cond, string sql)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetNhomVuViecsByCond"), ModuleId, cond, sql);
        }

        public override void UpdateNhomVuViec(int ModuleId,
            int id,
                                                    string code,
                                                    string title,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateNhomVuViec"), ModuleId,
                id,
                code,
title,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate


                );
        }
        // End NHóm vụ việc
        //  loại vụ việc
        public override void AddLoaiVuViec(int ModuleId,

                                               string code,
                                               string title,
                                               int ParentId,
                                               string Description,
                                               double temp_double1,
                                               double temp_double2,
                                               string temp_string1,
                                               string temp_string2,
                                               string temp_string3,
                                               int temp_int1,
                                               int temp_int2,
                                               int temp_int3,
                                               int CreatedByUser,
                                               DateTime CreatedDate,
                                               int UpdatedByUser,
                                               DateTime UpdatedDate
           )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddLoaiVuViec"), ModuleId,
                    code,
title,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate
                );
        }

        public override void DeleteLoaiVuViec(int ModuleId, int ItemId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteLoaiVuViec"), ModuleId, ItemId);
        }

        public override IDataReader GetLoaiVuViec(int ModuleId, int ItemId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetLoaiVuViec"), ModuleId, ItemId);
        }

        public override IDataReader GetLoaiVuViecs(int ModuleId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetLoaiVuViecs"), ModuleId);
        }

        public override IDataReader GetLoaiVuViecsByCond(int ModuleId, string cond, string sql)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetLoaiVuViecsByCond"), ModuleId, cond, sql);
        }

        public override void UpdateLoaiVuViec(int ModuleId,
            int id,
                                                    string code,
                                                    string title,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateLoaiVuViec"), ModuleId,
                id,
                code,
title,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate


                );
        }
        // End loại vụ việc
        // End Xử lý vụ việc
        public override void AddXuLyVuViec(int ModuleId,

                                               string code,
                                               string title,
                                               DateTime Thoigian,
                                               int ParentId,
                                               string Description,
                                               double temp_double1,
                                               double temp_double2,
                                               string temp_string1,
                                               string temp_string2,
                                               string temp_string3,
                                               int temp_int1,
                                               int temp_int2,
                                               int temp_int3,
                                               int CreatedByUser,
                                               DateTime CreatedDate,
                                               int UpdatedByUser,
                                               DateTime UpdatedDate
           )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddXuLyVuViec"), ModuleId,
                    code,
title,
Thoigian,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate
                );
        }

        public override void DeleteXuLyVuViec(int ModuleId, int ItemId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteXuLyVuViec"), ModuleId, ItemId);
        }

        public override IDataReader GetXuLyVuViec(int ModuleId, int ItemId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetXuLyVuViec"), ModuleId, ItemId);
        }

        public override IDataReader GetXuLyVuViecs(int ModuleId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetXuLyVuViecs"), ModuleId);
        }

        public override IDataReader GetXuLyVuViecsByCond(int ModuleId, string cond, string sql)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetXuLyVuViecsByCond"), ModuleId, cond, sql);
        }

        public override void UpdateXuLyVuViec(int ModuleId,
            int id,
                                                    string code,
                                                    string title,
                                                    DateTime Thoigian,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateXuLyVuViec"), ModuleId,
                id,
                code,
title,
Thoigian,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate


                );
        }
        // End Xử lý vụ việc

        //  vụ việc
        public override void AddVuViec(int ModuleId,

                                             int Quy,
int Nam,
int Tuan,
int Stt,
int loaivuviec,
int tenCN,
int tongCT,
DateTime ngayBaoCao,
string tomTatNoiDung,
int Chet_SQ,
int chet_QNCN,
int chet_CNVQP,
int chet_HDLD,
int chet_CTV,
int chet_Dan,
int biThuong_SQ,
int biThuong_QNCN,
int biThuong_CNVQP,
int biThuong_HDLD,
int biThuong_HDDV,
int biThuong_CTV,
int biThuong_CTV_Khac,
int biThuong_Dan,
double taiChinh,
int taiSan_otoViettel,
int taiSan_otoDanSu,
int taiSan_Moto,
string taiSan_Khac,
string thietHai_hangHoa,
int thietHai_MangLuoi_BTS,
int thietHai_MangLuoi_Phido,
int thietHai_MangLuoi_Acqui,
int thietHai_MangLuoi_TiepDia,
double thietHai_MangLuoi_Cap,
double TongThietHai,
int NguyenNhan_chuQuan,
int NguyenNhan_khacQuan,
int loi_quanNhan_SQ,
int loi_quanNhan_QNCN,
int loi_quanNhan_CSVQP,
int loi_quanNhan_HDLD,
int loi_quanNhan_CTV,
int loi_dan,
int DangVien,
int DoanVien,
string TInhCHat,
int baocao_TapDoan,
int baocao_CucDTHS,
int baocao_TUxuLy,
double KQ_Xulybandau,
string KQ_Tien,
string KQ_HinhThucKyLuat,
int KQ_Tamgiam,
int KQ_HinhPhat,
string CanBoTheodoi,
string otherText1,
string otherText2,
string otherText3,
string otherText4,
string otherText5,
string otherText6,
string otherText7,
string otherText8,
int otherInt1,
int otherInt2,
int otherInt3,
int otherInt4,
int otherInt5,
int otherInt6,
double otherInt7,
double otherInt8,
DateTime otherDatetime1,
DateTime otherDatetime2,
DateTime otherDatetime3,
DateTime otherDatetime4,
DateTime otherDatetime5,
DateTime otherDatetime6,
DateTime otherDatetime7,
DateTime otherDatetime8,
                                               int CreatedByUser,
                                               DateTime CreatedDate,
                                               int UpdatedByUser,
                                               DateTime UpdatedDate
           )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddVuViec"), ModuleId,

 Quy,
 Nam,
 Tuan,
 Stt,
 loaivuviec,
 tenCN,
 tongCT,
 ngayBaoCao,
 tomTatNoiDung,
 Chet_SQ,
 chet_QNCN,
 chet_CNVQP,
 chet_HDLD,
 chet_CTV,
 chet_Dan,
 biThuong_SQ,
 biThuong_QNCN,
 biThuong_CNVQP,
 biThuong_HDLD,
 biThuong_HDDV,
 biThuong_CTV,
 biThuong_CTV_Khac,
 biThuong_Dan,
 taiChinh,
 taiSan_otoViettel,
 taiSan_otoDanSu,
 taiSan_Moto,
 taiSan_Khac,
 thietHai_hangHoa,
 thietHai_MangLuoi_BTS,
 thietHai_MangLuoi_Phido,
 thietHai_MangLuoi_Acqui,
 thietHai_MangLuoi_TiepDia,
 thietHai_MangLuoi_Cap,
 TongThietHai,
 NguyenNhan_chuQuan,
 NguyenNhan_khacQuan,
 loi_quanNhan_SQ,
 loi_quanNhan_QNCN,
 loi_quanNhan_CSVQP,
 loi_quanNhan_HDLD,
 loi_quanNhan_CTV,
 loi_dan,
 DangVien,
 DoanVien,
 TInhCHat,
 baocao_TapDoan,
 baocao_CucDTHS,
 baocao_TUxuLy,
 KQ_Xulybandau,
 KQ_Tien,
 KQ_HinhThucKyLuat,
 KQ_Tamgiam,
 KQ_HinhPhat,
 CanBoTheodoi,
 otherText1,
 otherText2,
 otherText3,
 otherText4,
 otherText5,
 otherText6,
 otherText7,
 otherText8,
 otherInt1,
 otherInt2,
 otherInt3,
 otherInt4,
 otherInt5,
 otherInt6,
 otherInt7,
 otherInt8,
 otherDatetime1,
 otherDatetime2,
 otherDatetime3,
 otherDatetime4,
 otherDatetime5,
 otherDatetime6,
 otherDatetime7,
 otherDatetime8,

CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate
                );
        }

        public override void DeleteVuViec(int ModuleId, int ItemId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteVuViec"), ModuleId, ItemId);
        }

        public override IDataReader GetVuViec(int ModuleId, int ItemId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetVuViec"), ModuleId, ItemId);
        }

        public override IDataReader GetVuViecs(int ModuleId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetVuViecs"), ModuleId);
        }

        public override IDataReader GetVuViecsByCond(int ModuleId, string cond, string sql)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetVuViecsByCond"), ModuleId, cond, sql);
        }

        public override void UpdateVuViec(int ModuleId,
              int id,
                                                   int Quy,
int Nam,
int Tuan,
int Stt,
int loaivuviec,
int tenCN,
int tongCT,
DateTime ngayBaoCao,
string tomTatNoiDung,
int Chet_SQ,
int chet_QNCN,
int chet_CNVQP,
int chet_HDLD,
int chet_CTV,
int chet_Dan,
int biThuong_SQ,
int biThuong_QNCN,
int biThuong_CNVQP,
int biThuong_HDLD,
int biThuong_HDDV,
int biThuong_CTV,
int biThuong_CTV_Khac,
int biThuong_Dan,
double taiChinh,
int taiSan_otoViettel,
int taiSan_otoDanSu,
int taiSan_Moto,
string taiSan_Khac,
string thietHai_hangHoa,
int thietHai_MangLuoi_BTS,
int thietHai_MangLuoi_Phido,
int thietHai_MangLuoi_Acqui,
int thietHai_MangLuoi_TiepDia,
double thietHai_MangLuoi_Cap,
double TongThietHai,
int NguyenNhan_chuQuan,
int NguyenNhan_khacQuan,
int loi_quanNhan_SQ,
int loi_quanNhan_QNCN,
int loi_quanNhan_CSVQP,
int loi_quanNhan_HDLD,
int loi_quanNhan_CTV,
int loi_dan,
int DangVien,
int DoanVien,
string TInhCHat,
int baocao_TapDoan,
int baocao_CucDTHS,
int baocao_TUxuLy,
double KQ_Xulybandau,
string KQ_Tien,
string KQ_HinhThucKyLuat,
int KQ_Tamgiam,
int KQ_HinhPhat,
string CanBoTheodoi,
string otherText1,
string otherText2,
string otherText3,
string otherText4,
string otherText5,
string otherText6,
string otherText7,
string otherText8,
int otherInt1,
int otherInt2,
int otherInt3,
int otherInt4,
int otherInt5,
int otherInt6,
double otherInt7,
double  otherInt8,
DateTime otherDatetime1,
DateTime otherDatetime2,
DateTime otherDatetime3,
DateTime otherDatetime4,
DateTime otherDatetime5,
DateTime otherDatetime6,
DateTime otherDatetime7,
DateTime otherDatetime8,
            int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateVuViec"), ModuleId,
                 id,
 Quy,
 Nam,
 Tuan,
 Stt,
 loaivuviec,
 tenCN,
 tongCT,
 ngayBaoCao,
 tomTatNoiDung,
 Chet_SQ,
 chet_QNCN,
 chet_CNVQP,
 chet_HDLD,
 chet_CTV,
 chet_Dan,
 biThuong_SQ,
 biThuong_QNCN,
 biThuong_CNVQP,
 biThuong_HDLD,
 biThuong_HDDV,
 biThuong_CTV,
 biThuong_CTV_Khac,
 biThuong_Dan,
 taiChinh,
 taiSan_otoViettel,
 taiSan_otoDanSu,
 taiSan_Moto,
 taiSan_Khac,
 thietHai_hangHoa,
 thietHai_MangLuoi_BTS,
 thietHai_MangLuoi_Phido,
 thietHai_MangLuoi_Acqui,
 thietHai_MangLuoi_TiepDia,
 thietHai_MangLuoi_Cap,
 TongThietHai,
 NguyenNhan_chuQuan,
 NguyenNhan_khacQuan,
 loi_quanNhan_SQ,
 loi_quanNhan_QNCN,
 loi_quanNhan_CSVQP,
 loi_quanNhan_HDLD,
 loi_quanNhan_CTV,
 loi_dan,
 DangVien,
 DoanVien,
 TInhCHat,
 baocao_TapDoan,
 baocao_CucDTHS,
 baocao_TUxuLy,
 KQ_Xulybandau,
 KQ_Tien,
 KQ_HinhThucKyLuat,
 KQ_Tamgiam,
 KQ_HinhPhat,
 CanBoTheodoi,
 otherText1,
 otherText2,
 otherText3,
 otherText4,
 otherText5,
 otherText6,
 otherText7,
 otherText8,
 otherInt1,
 otherInt2,
 otherInt3,
 otherInt4,
 otherInt5,
 otherInt6,
 otherInt7,
 otherInt8,
 otherDatetime1,
 otherDatetime2,
 otherDatetime3,
 otherDatetime4,
 otherDatetime5,
 otherDatetime6,
 otherDatetime7,
 otherDatetime8,

CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate


                );
        }
        // vụ việc


        // kết hợp xử lý
        public override void AddKetHopXuLy(int ModuleId,

                                               string code,
                                               string title,
                                               DateTime Thoigian,
                                               int ParentId,
                                               string Description,
                                               double temp_double1,
                                               double temp_double2,
                                               string temp_string1,
                                               string temp_string2,
                                               string temp_string3,
                                               int temp_int1,
                                               int temp_int2,
                                               int temp_int3,
                                               int CreatedByUser,
                                               DateTime CreatedDate,
                                               int UpdatedByUser,
                                               DateTime UpdatedDate
           )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddKetHopXuLy"), ModuleId,
                    code,
title,
Thoigian,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate
                );
        }

        public override void DeleteKetHopXuLy(int ModuleId, int ItemId)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteKetHopXuLy"), ModuleId, ItemId);
        }

        public override IDataReader GetKetHopXuLy(int ModuleId, int ItemId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetKetHopXuLy"), ModuleId, ItemId);
        }

        public override IDataReader GetKetHopXuLys(int ModuleId)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetKetHopXuLys"), ModuleId);
        }

        public override IDataReader GetKetHopXuLysByCond(int ModuleId, string cond, string sql)
        {
            return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetKetHopXuLysByCond"), ModuleId, cond, sql);
        }

        public override void UpdateKetHopXuLy(int ModuleId,
            int id,
                                                    string code,
                                                    string title,
                                                    DateTime Thoigian,
                                                    int ParentId,
                                                    string Description,
                                                    double temp_double1,
                                                    double temp_double2,
                                                    string temp_string1,
                                                    string temp_string2,
                                                    string temp_string3,
                                                    int temp_int1,
                                                    int temp_int2,
                                                    int temp_int3,
                                                    int CreatedByUser,
                                                    DateTime CreatedDate,
                                                    int UpdatedByUser,
                                                    DateTime UpdatedDate

            )
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateKetHopXuLy"), ModuleId,
                id,
                code,
title,
Thoigian,
ParentId,
Description,
temp_double1,
temp_double2,
temp_string1,
temp_string2,
temp_string3,
temp_int1,
temp_int2,
temp_int3,
CreatedByUser,
CreatedDate,
UpdatedByUser,
UpdatedDate


                );
        }
        // End Kết hợp xử lý
    #endregion

    }
}
